package com.dubbo.config;

import com.dubbo.interceper.HandlerInterceptorCustom;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class CustomWebAppConfig implements WebMvcConfigurer {
	@Resource
	private HandlerInterceptorCustom handlerInterceptorCustom;
	/**
	 * 配置拦截路径
	 * @author chenluqiang
	 * @date 2019年3月13日 上午10:12:22 
	 *	@param registry
	 */
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		System.out.println("++++++++++++++++++++++++");
//		List<String> list = new ArrayList<>();
		/*list.add("/home/");
		list.add("/category/");
		list.add("/address/");
		list.add("/techincianLogin/");
		list.add("/my/**");*/
		// 这里不要用new 创建对象，会导致，拦截器里面不能依赖注入！redisDao会为空
		//registry.addInterceptor(new HandlerInterceptorCustom())
		registry.addInterceptor(handlerInterceptorCustom)
		.addPathPatterns("/**")
//		.addPathPatterns(list)
		;
	}
}
